﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TemplateWizard;

namespace XamlTemplateWizard
{
    public class XamlTemplateSelector : IWizard
    {
        #region public void  BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
        public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
        {
        }
        #endregion


        #region public void  ProjectFinishedGenerating(EnvDTE.Project project)
        public void ProjectFinishedGenerating(EnvDTE.Project project)
        {
        }
        #endregion


        #region public void  ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        {
        }
        #endregion


        #region public void  RunFinished()
        public void RunFinished()
        {
        }
        #endregion

        private bool shouldAdd = false;

        #region public void  RunStarted(object automationObject, Dictionary<string,string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            XamlTemplateChooser chooser = new XamlTemplateChooser();
            EnvDTE._DTE dte = automationObject as EnvDTE._DTE;
            chooser.DTE = dte.DTE;
            chooser.Dictionary = replacementsDictionary;
            shouldAdd = chooser.ShowDialog() == true;
        }
        #endregion


        #region public bool  ShouldAddProjectItem(string filePath)
        public bool ShouldAddProjectItem(string filePath)
        {
            return shouldAdd;
        }
        #endregion

    }
}
